package com.demo.services.impl;

import com.demo.database.data.TDemoPosition;
import com.demo.database.mapper.TDemoPositionMapper;
import com.demo.services.IPositionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.List;

/**
 * 员工管理业务实现接口实现类
 * @cuthor luoxiaojiang
 * @createTime 2019年11月17日21:07:07
 * @Verson 1.0.0
 */
@Service
public class PositionServiceImpl implements IPositionService {

    @Resource
    private TDemoPositionMapper positionMapper;

    @Override
    public List<TDemoPosition> positionQuery() throws Exception {
        List<TDemoPosition> positions = positionMapper.positionQuery();
        return positions;
    }

    @Override
    public TDemoPosition positionQueryID(Integer positionId) throws Exception {

        return positionMapper.positionQueryID(positionId);
    }

    @Override
    public List<TDemoPosition> positionQuery1(String context) throws Exception {

        return positionMapper.positionQuery1(context);
    }

    @Override
    public List<TDemoPosition> positionAdd(TDemoPosition position) throws Exception {
        position.setOperTime(new Timestamp(System.currentTimeMillis()));
        positionMapper.positionAdd(position);
        return positionMapper.positionQuery();
    }

    @Override
    public List<TDemoPosition> positionUpd(TDemoPosition position) throws Exception {
        position.setOperTime(new Timestamp(System.currentTimeMillis()));
        positionMapper.positionUpd(position);
        return positionMapper.positionQuery();
    }

    @Override
    public List<TDemoPosition> positionDel(String... ids) throws Exception {
        positionMapper.positionDel(ids);
        return positionMapper.positionQuery();
    }
}
